//
//  SportRecordModel.swift
//  LKSportManagerSDK
//
//  Created by KuaiKuai on 2023/8/23.
//

import UIKit

public class SportRecordModel: NSObject {
    //UUID
    let uuid: String
    //运动ID
    let id: String
    //用户id
    let userid: String
    //创建时间
    let createTime: Int = 0
    //运动时长
    var duration: Int = 0
    //消耗
    var burn: Int = 0
    //消耗得分
    var burnScore: Int = 0
    //心率得分
    var heartRateScore: Int = 0
    //动作得分
    var actionScore: Int = 0
    //总分
    var totalScore: Int = 0
    // l1等级次数
    var l1Count: Int = 0
    // 等级次数
    var l2Count: Int = 0
    // 等级次数
    var l3Count: Int = 0
    // 火力全开时长
    var fireDuration: Int = 0
    // 心率爆表时长
    var heartRateBlastDuration: Int = 0
    // 计算数据
    var countDatas: [SportDataCountModel]  = []
    
    init(uuid: String, id: String, userid: String) {
        self.uuid = uuid
        self.id = id
        self.userid = userid
    }
    
    public override var description: String {
        let i = 0
        if i == 0 {
            let heart:Int = countDatas.last?.heartRate ?? 0
            let str = String(heart)
            return "运动记录ID:\(uuid)   " + "用户ID:\(userid)   " + "总得分\(totalScore)   " + "心率:\(str)   " + "动作得分:\(actionScore)" + "" + "" + "" + "" + ""
        }
        if i == 1 {
            let instensity = countDatas.last?.actionIntensity ?? 0
            let actionScore = countDatas.last?.actionScore ?? 0
            return "运动记录ID:\(uuid)   " + "原始动作强度:\(instensity)   " + "瞬时动作得分:\(actionScore)" + "" + "" + "" + "" + ""
        }
    }
    deinit {
        print("运动记录Model销毁")
    }
}
